
Now that Ubuntu Touch has upgraded from Focal (20.04) to Noble (24.04) as their base, all of those apps that I updated from Xenial (16.XX) to Focal have to be updated again. Fortunately for me, the list is much shorter this time!
I decided to start with Emerald, the gemini browser that I updated first last time. Principally because it needed to be fixed to work on Noble. A lot of the Focal apps just work out of the box with Noble, but this one didn't. When you open the app, it did absolutely nothing. Just sat their with the dark gray background.
Using the log viewer app from the open-store [1], I was able to find the issue.... You see, it is python based and uses natsort. For speed benefits, it also could use fastnumbers. And every time you load a capsule (gemlog page) it would first try to use fastnumbers. However, to use fastnumbers, the original code would use strictversion, a subset of distutils to compare the numbers. Or at least, that is what I gathered looking at the code. It went like this:
from distutils.version import StrictVersion
# If the user has fastnumbers installed, they will get great speed
# benefits. If not, we use the simulated functions that come with natsort.
try:
# noinspection PyPackageRequirements
from fastnumbers import fast_float, fast_int, __version__ as fn_ver
# Require >= version 2.0.0.
if StrictVersion(fn_ver) < StrictVersion("2.0.0"):
except ImportError:
from natsort.compat.fake_fastnumbers import fast_float, fast_int # noqa: F401
But, when updating from Focal to Noble, python was updated to greater than 3.12. And that means that distutils is depreciated! So, we were getting an error before the try block to say that there was no such module as distutils. Fortunately for me, the original author already made a fallback to natsort to use a compatible fake_fastnumbers to get the job done if need be.
So, I just edited it to always use the fallback of natsort's fake_fastnumbers instead. I can't seem to tell the difference in function, so it seems like a win to me. Now it reads like this:
# from distutils.version import StrictVersion
# If the user has fastnumbers installed, they will get great speed
# benefits. If not, we use the simulated functions that come with natsort.
try:
# noinspection PyPackageRequirements
#from fastnumbers import fast_float, fast_int, __version__ as fn_ver
# Require >= version 2.0.0.
#if StrictVersion(fn_ver) < StrictVersion("2.0.0"):
from natsort.compat.fake_fastnumbers import fast_float, fast_int # noqa: F401
except ImportError:
from natsort.compat.fake_fastnumbers import fast_float, fast_int # noqa: F401
Dirty looking, I know, I just commented out the old code and copy/pasted the fallback into the try block, but it seems to get the job done. At least, to a non-programmer like me!
Linux - keep it simple.